﻿using AutoMapper;
using MediatR;
using S.Organization.API.Application.Command.SheepFarmCommand;
using S.Organization.API.Application.Command.SubcultivationCommand;
using S.Organization.Domian.Model;
using S.Organization.Infrastructure;

namespace S.Organization.API.Application.CommandHandler.SubcultivationCommandHandler
{
    public class DelSubcultivationCommandHandler : IRequestHandler<DelSubcultivationCommand, int>
    {
        private readonly IBaseRepository<Subcultivation> _repository; 
        private readonly IMapper mapper;

        public DelSubcultivationCommandHandler(IBaseRepository<Subcultivation> repository,  IMapper mapper)
        {
            _repository = repository;
            this.mapper = mapper; 
        }

        public async Task<int> Handle(DelSubcultivationCommand request, CancellationToken cancellationToken)
        {
 
            return await _repository.DeleteAsync(request.Id);
        }
    }
}
